package com.cainiao.exception;

import com.cainiao.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public Result handleException(Exception e){
        log.error("全局异常处理器,拦截到的异常",e);
        return Result.error(e.getMessage());
    }
    @ExceptionHandler
    public Result error(BuinessException e){
        log.error("删除部门业务异常{}",e);
        return Result.error(e.getMessage());

    }
}
